package study.ttl.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import study.ttl.entity.Orders;

import java.util.List;

@Mapper
public interface OrdersMapper {

    // 插入日志
    void insert(Orders orders);

    // 根据id删除
    @Delete("delete from orders where id = #{id}")
    void deleteById(Integer id);

    // 根据id修改
    void updateById(Orders orders);

    // 根据id查询
    @Select("select * from orders where id = #{id}")
    Orders selectById(Integer id);

    // 根据条件查询所有
    List<Orders> selectAll(Orders orders);

    // 批量删除
    void deleteBatch(List<Integer> ids);

    // 根据订单号查询
    @Select("select * from orders where order_no = #{orderNo}")
    Orders selectByOrderNo(String orderNo);

    // 根据订单状态查询
    @Select("select * from orders where status = #{status}")
    List<Orders> selectByStatus(String status);

    List<Orders> selectAllGroup(Orders orders);
}
